package com.example.hhhh;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.example.hhhh.util.FrameworkConst;
import com.example.hhhh.util.FrameworkUtil;

import java.io.File;


@Route(path = "/app/MainActivity2")
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private Button one, two, three, four, five, six, seventh, eighth, ninth, tenth, eleven, twelve, thirteen, fourteen, fifteen, sixteen;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ARouter.getInstance().inject(this);

        new Thread(new Runnable() {
            @Override
            public void run() {
                createDir();
            }
        }).start();
        one = findViewById(R.id.one);
        two = findViewById(R.id.two);
        three = findViewById(R.id.three);
        four = findViewById(R.id.four);
        five = findViewById(R.id.five);
        six = findViewById(R.id.six);
        seventh = findViewById(R.id.seventh);
        eighth = findViewById(R.id.eighth);
        ninth = findViewById(R.id.ninth);
        tenth = findViewById(R.id.tenth);
        eleven = findViewById(R.id.eleven);
        twelve = findViewById(R.id.twelve);
        thirteen = findViewById(R.id.thirteen);
        fourteen = findViewById(R.id.fourteen);
        fifteen = findViewById(R.id.fifteen);
        sixteen = findViewById(R.id.sixteen);


        one.setOnClickListener(this);
        two.setOnClickListener(this);
        three.setOnClickListener(this);
        four.setOnClickListener(this);
        five.setOnClickListener(this);
        six.setOnClickListener(this);
        seventh.setOnClickListener(this);
        eighth.setOnClickListener(this);
        ninth.setOnClickListener(this);
        tenth.setOnClickListener(this);
        eleven.setOnClickListener(this);
        twelve.setOnClickListener(this);
        thirteen.setOnClickListener(this);
        fourteen.setOnClickListener(this);
        fifteen.setOnClickListener(this);
        sixteen.setOnClickListener(this);

//        tv.setText(NumberUtils.hidePhoneNumberUtil("13268228888"));
//        tv1.setText(NumberUtils.hidePhoneNumberUtil("68888888"));

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.one:
                //
                ARouter.getInstance().build("/app/FristAct").navigation();
                break;
            case R.id.two:
                //
                ARouter.getInstance().build("/app/TwoAct").withBoolean("two", false).navigation();
                break;
            case R.id.three:
                //
                ARouter.getInstance().build("/app/ThreeAct").withInt("age", 3).navigation();
                break;
            case R.id.four:
                //
                ARouter.getInstance().build("/app/FourAct").navigation();
                break;
            case R.id.five:
                //
                ARouter.getInstance().build("/app/FiveAct").navigation();

                break;
            case R.id.six:
                //
                ARouter.getInstance().build("/app/SixAct").navigation();
                break;
            case R.id.seventh:
                //
                ARouter.getInstance().build("/app/SeventhAct").navigation();
                break;
            case R.id.eighth:
                //
                ARouter.getInstance().build("/app/EighthAct").navigation();
                break;
            case R.id.ninth:
                //
                ARouter.getInstance().build("/app/NinthAct").navigation();
                break;
            case R.id.tenth:
                //
                ARouter.getInstance().build("/app/TenthAct").navigation();
                break;
            case R.id.eleven:
                //
                ARouter.getInstance().build("/app/ElevenAct").navigation();
                break;
            case R.id.twelve:
                //
                ARouter.getInstance().build("/app/TewlveAct").navigation();
                break;
            case R.id.thirteen:
                //
                ARouter.getInstance().build("/app/ThirteenAct").navigation();
                break;
            case R.id.fourteen:
                //
                ARouter.getInstance().build("/app/FourteenAct").navigation();
                break;
            case R.id.fifteen:
                //
                ARouter.getInstance().build("/app/FifteenAct").navigation();
                break;
            case R.id.sixteen:
                //
                ARouter.getInstance().build("/app/SixteenAct").navigation();
                break;

        }

    }




    /**
     *
     * 创建日志，apk，图片3个文件夹
     */
    protected void createDir(){
        //创建项目相关根目
        String rootPath = FrameworkConst.FILE_PATH;
        File mRootFile = new File(rootPath);
        if (!mRootFile.exists()) {
            mRootFile.mkdir();
        }
        //升级apk的保存目
        File mApkFile = new File(FrameworkUtil.getApkPath());
        if (!mApkFile.exists()) {
            mApkFile.mkdir();
        }
        //日志的保存目
        File mLogFile = new File(FrameworkUtil.getLogPath());
        if (!mLogFile.exists()) {
            mLogFile.mkdir();
        }
        //图片的保存目
        File mImageFile = new File(FrameworkUtil.getImagePath());
        if (!mImageFile.exists()) {
            mImageFile.mkdir();
        }
        //音频的保存目
        File mAudioFile = new File(FrameworkUtil.getAudioPath());
        if (!mAudioFile.exists()) {
            mAudioFile.mkdir();
        }
        //图片压缩的保存目
        File mCompressFile = new File(FrameworkUtil.getCompressImagePath());
        if (!mCompressFile.exists()) {
            mCompressFile.mkdir();
        }
        //图片压缩的保存目
        File mOtherFile = new File(FrameworkUtil.getOtherFilePath());
        if (!mOtherFile.exists()) {
            mOtherFile.mkdir();
        }
    }
}
